<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
</head>

<body>
    <header class="aui-bar aui-bar-nav header">
        <!-- <a class="aui-pull-left">
        <span class="aui-iconfont aui-icon-left"></span>
    </a> -->




</body>
<script type="text/javascript" src="./script/api.js"></script>

</html>
<script>
    var NVTabBar;

    function user() {
        api.openWin({
            name: 'user',
            url: './user.html',
        });
    }

    function classification() {
        api.openWin({
            name: 'classify',
            url: './classify.html',
        });
    }

    function search() {
        api.openWin({
            name: 'search',
            url: './search.html',
        });
    }

    apiready = function() {
        NVTabBar = api.require('NVTabBar');
        var color = $api.getStorage('color');
        $(".theme").attr("href", color);
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err) {
            api.closeWidget();
        })

        natabBar();
        window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", hengshuping, false);
        api.setScreenOrientation({
            orientation: 'auto'
        });
        // var i = $api.getStorage('isJianli');
        // console.log(i);
        // if (i==1) {
        //   setTimeout("jianli()", 300);
        // }
    }

    function jianli() {
        api.openWin({
            name: 'jianli',
            url: './jianli.html',
        });

    }



    function natabBar() {
        var tabIndex = $api.getStorage('tabIndex');

        NVTabBar.open({
            styles: {
                bg: '#f7f7fa',
                //bg:"widget://image/NVTabBar/tabbar_bg.png",
                h: 65,
                dividingLine: {
                    width: 0,
                    color: '#000'
                },
                badge: {
                    bgColor: '#fff',
                    numColor: '#fff',
                    size: 6.0,
                    centerX: 40,
                    centerY: 6
                }
            },
            items: [{
                w: api.winWidth / 4.0,
                bg: {
                    marginB: -4,
                    // image: 'rgba(200,200,200,0.6)'
                },
                iconRect: {
                    w: 20.0,
                    h: 20.0,
                },
                icon: {
                    normal: 'widget://images/NVTabBar/acti.png',
                    highlight: 'widget://images/NVTabBar/actied.png',
                    selected: 'widget://images/NVTabBar/actied.png'
                },
                title: {
                    text: '分类查询',
                    size: 12.0,
                    normal: '#696969',
                    selected: '#2777bb',
                    marginB: 6.0
                }
            }, {
                w: api.winWidth / 4.0,
                bg: {
                    marginB: -4,
                    // image: 'rgba(200,200,200,0.7)'
                },
                iconRect: {
                    w: 22.0,
                    h: 22.0,
                },
                icon: {
                    normal: 'widget://images/NVTabBar/fav.png',
                    highlight: 'widget://images/NVTabBar/faved.png',
                    selected: 'widget://images/NVTabBar/faved.png'
                },
                title: {
                    text: '条件查询',
                    size: 12.0,
                    normal: '#696969',
                    selected: '#2777bb',
                    marginB: 6.0
                }
            }, {
                w: api.winWidth / 4.0,
                bg: {
                    marginB: -5,
                    // image: 'rgba(200,20,0,0.6)'
                },
                iconRect: {
                    w: 20.0,
                    h: 20.0,
                },
                icon: {
                    normal: 'widget://images/NVTabBar/searchedd.png',
                    highlight: 'widget://images/NVTabBar/searche.png',
                    selected: 'widget://images/NVTabBar/searche.png'
                },
                title: {
                    text: '自定义查询',
                    size: 12.0,
                    normal: '#696969',
                    selected: '#2777bb',
                    marginB: 6.0
                }
            }, {
                w: api.winWidth / 4.0,
                bg: {
                    marginB: -4,
                    // image: 'rgba(200,20,0,0.6)'
                },
                iconRect: {
                    w: 20.0,
                    h: 20.0,
                },
                icon: {
                    normal: 'widget://images/NVTabBar/user.png',
                    highlight: 'widget://images/NVTabBar/usered.png',
                    selected: 'widget://images/NVTabBar/usered.png'
                },
                title: {
                    text: '相关资料',
                    size: 12.0,
                    normal: '#696969',
                    selected: '#2777bb',
                    marginB: 6.0
                }
            }],
            // selectedIndex: 0
        }, function(ret, err) {
            api.openFrameGroup({
                name: 'nav',
                background: '#fff',
                scrollEnabled: false,
                rect: {
                    x: 0,
                    y: 0,
                    w: 'auto',
                    h: api.winHeight - 50
                },
                preload: 0,
                index: 0,
                frames: [{
                    name: 'temp',
                    url: './temp.html',
                    bgColor: '#fff'
                }, {
                    name: 'fangan',
                    url: './fangan.html',
                    bgColor: '#fff'
                }, {
                    name: 'search-new',
                    url: './search-new.html',
                    bgColor: '#fff'
                }, {
                    name: 'pdf',
                    url: 'file:///storage/emulated/0/pdf/index_1.htm',
                    // url: './html/index_1.htm',
                    bgColor: '#fff'
                }]
            }, function(ret, err) {});
            // file:///storage/emulated/0/pdf/index.htm
            api.closeFrameGroup({
                name: 'classifyGrop'
            });
            api.closeFrame({
                name: 'classify-imgNew'
            });
            api.closeFrame({
                name: 'fananSearch'
            });
            api.closeFrame({
                name: 'classify-imgSearch'
            });
            api.closeToWin({
                name: 'index'
            });
            $api.setStorage('tabIndex', ret.index);
            // api.sendFrameToBack({
            //     from: 'classifyGrop',
            // });

            api.setFrameGroupIndex({
                name: 'nav',
                index: ret.index,
                reload: true,
            });
            if (ret.index == 3) {
                api.sendEvent({
                    name: 'backUrl',

                });
            }
        });
    }

    function reloadIndex() {
        api.setFrameGroupIndex({
            name: 'nav',
            index: 0,
            reload: true,
        });
    }

    function hengshuping() {
        var i = $api.getStorage('isJianli');
        if (i == 1) {
            return;
        }

        NVTabBar.close();
        api.closeFrameGroup({
            name: 'nav'
        });
        api.openWin({
            name: 'index',
            url: './index.html',
            reload: true
        });


    }

    function jianlireload() {

        NVTabBar.close();
        api.closeFrame({
            name: 'classify-imgNew'
        });
        api.closeFrame({
            name: 'classify-imgSearch'
        });
        api.closeFrame({
            name: 'fananSearch'
        });
        api.closeFrameGroup({
            name: 'classifyGrop'
        });

        api.closeFrameGroup({
            name: 'nav'
        });
        api.openWin({
            name: 'index',
            url: './index.html',
            reload: true
        });

        api.closeWin({
            name: 'jianli'
        });

    }
</script>
